<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>Elastic-Monitor 服务监控报警 | Wei Echo | 高效稳定 · 简洁易用 · 灵活扩展</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="微服务,java,监控报警">
    <meta name="description" content="策略配置说明 1、黑名单策略配置主要用于关键功能点报警，周期为20秒，可结合各项指标的interval设定数据分析间隔时间，message内包含keywords词组即报警，可以通过配置declaringClass + methodName + keywords组合方式实现项目的全局 &#x2F; 细粒度报警，周期线程接近于实时的快速检测保证服务关键业务快速报警响应。 业务功能范围：访问异常报警、业务问题项报">
<meta property="og:type" content="article">
<meta property="og:title" content="Elastic-Monitor 服务监控报警">
<meta property="og:url" content="https://github.com/weiecho/2020/09/12/doc_1128/index.html">
<meta property="og:site_name" content="Wei Echo">
<meta property="og:description" content="策略配置说明 1、黑名单策略配置主要用于关键功能点报警，周期为20秒，可结合各项指标的interval设定数据分析间隔时间，message内包含keywords词组即报警，可以通过配置declaringClass + methodName + keywords组合方式实现项目的全局 &#x2F; 细粒度报警，周期线程接近于实时的快速检测保证服务关键业务快速报警响应。 业务功能范围：访问异常报警、业务问题项报">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-09-12T07:36:05.000Z">
<meta property="article:modified_time" content="2020-09-10T09:54:55.318Z">
<meta property="article:author" content="Wei Echo">
<meta property="article:tag" content="微服务">
<meta property="article:tag" content="java">
<meta property="article:tag" content="监控报警">
<meta name="twitter:card" content="summary">
    
        <link rel="alternate" type="application/atom+xml" title="Wei Echo" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="/css/style.css?v=1.7.2">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

<meta name="generator" content="Hexo 4.2.1"></head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu"  >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">Wei Echo</h5>
          <a href="mailto:lonyee@live.com" title="lonyee@live.com" class="mail">lonyee@live.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0"  >
                <i class="icon icon-lg icon-mortar-board"></i>
                学习笔记
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories/%E7%BB%8F%E9%AA%8C%E5%88%86%E4%BA%AB"  >
                <i class="icon icon-lg icon-puzzle-piece"></i>
                经验分享
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories/%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7"  >
                <i class="icon icon-lg icon-cubes"></i>
                常用工具
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/weiecho" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                我的项目
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories/%E5%BC%80%E6%BA%90%E6%96%87%E6%A1%A3"  >
                <i class="icon icon-lg icon-gbp"></i>
                开源文档
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                文章列表
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/links"  >
                <i class="icon icon-lg icon-link"></i>
                友情链接
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">Elastic-Monitor 服务监控报警</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">Elastic-Monitor 服务监控报警</h1>
        <h5 class="subtitle">
            
                <time datetime="2020-09-12T07:36:05.000Z" itemprop="datePublished" class="page-time">
  2020-09-12
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/%E5%BC%80%E6%BA%90%E6%96%87%E6%A1%A3/">开源文档</a></li></ul>

            
        </h5>
    </div>
    
    


</header>


<div class="container body-wrap">
    

<article id="post-doc_1128"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">Elastic-Monitor 服务监控报警</h1>
        <div class="post-meta">
            <time class="post-time" title="2020-09-12 15:36:05" datetime="2020-09-12T07:36:05.000Z"  itemprop="datePublished">2020-09-12</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/%E5%BC%80%E6%BA%90%E6%96%87%E6%A1%A3/">开源文档</a></li></ul>



            

        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h4 id="策略配置说明"><a href="#策略配置说明" class="headerlink" title="策略配置说明"></a>策略配置说明</h4><hr>
<h5 id="1、黑名单策略配置"><a href="#1、黑名单策略配置" class="headerlink" title="1、黑名单策略配置"></a>1、黑名单策略配置</h5><p>主要用于关键功能点报警，周期为20秒，可结合各项指标的interval设定数据分析间隔时间，message内包含keywords词组即报警，可以通过配置declaringClass + methodName + keywords组合方式实现项目的全局 / 细粒度报警，周期线程接近于实时的快速检测保证服务关键业务快速报警响应。</p>
<p>业务功能范围：访问异常报警、业务问题项报警、各类可预期性报警。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    blacklist:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0/20 * * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="string">c678f3a0d6b8a19ab07c62a847994aaf3e684cfa7a41827dec7d91568b78ca1e</span></span><br><span class="line"><span class="attr">          subject:</span> <span class="string">XX关键点报警</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-sms-provider</span></span><br><span class="line"><span class="attr">          declaringClass:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          methodName:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          limit:</span> <span class="number">0</span> <span class="comment">#频次阈值</span></span><br><span class="line"><span class="attr">          interval:</span> <span class="number">300</span> <span class="comment">#5分钟</span></span><br><span class="line"><span class="attr">          keywords:</span></span><br><span class="line"><span class="bullet">            -</span> <span class="string">Alert</span></span><br><span class="line"><span class="bullet">            -</span> <span class="string">Call</span></span><br></pre></td></tr></table></figure>

<h5 id="2、白名单策略配置"><a href="#2、白名单策略配置" class="headerlink" title="2、白名单策略配置"></a>2、白名单策略配置</h5><p>主要用于核心功能点报警，周期为30秒/次，可结合各项指标的interval设定数据分析间隔时间，message内未包含keywords词组即报警，可以通过配置declaringClass + methodName + keywords组合方式实现项目的全局 / 细粒度报警，周期线程接近于实时的快速检测保证服务关键业务快速报警响应。</p>
<p>业务功能范围：关键业务点必须有Token、预设防非法攻击参数等。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    whitelist:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0/30 * * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="string">c678f3a0d6b8a19ab07c62a847994aaf3e684cfa7a41827dec7d91568b78ca1e</span></span><br><span class="line"><span class="attr">          subject:</span> <span class="string">XX关键点报警</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-sms-provider</span></span><br><span class="line"><span class="attr">          declaringClass:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          methodName:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          limit:</span> <span class="number">1</span> <span class="comment">#频次阈值</span></span><br><span class="line"><span class="attr">          interval:</span> <span class="number">300</span> <span class="comment">#5分钟</span></span><br><span class="line"><span class="attr">          keywords:</span></span><br><span class="line"><span class="bullet">            -</span> <span class="string">mobile</span></span><br></pre></td></tr></table></figure>

<h5 id="3、环比策略配置"><a href="#3、环比策略配置" class="headerlink" title="3、环比策略配置"></a>3、环比策略配置</h5><p>主要用于服务业务快速增长点/下降点预知和压力点防灾，周期为1分钟/次，可结合各项指标的interval设定数据分析间隔时间，可设置日志level、环比天数relative、浮动比例 limit，可以通过配置declaringClass + methodName + level组合方式实现项目的全局 / 细粒度报警，及时感知服务点激增爆点，预算服务抗压策略。</p>
<p>业务功能范围：服务访问量对比、日志异常量对比、服务全量日志量对比、关键业务点日志量比对。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    relative:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0 0/5 * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="string">a483f4b1375a5a33b068c292413562c6aef6b32d7d1ae150c4d47d32f4af9322</span></span><br><span class="line"><span class="attr">          subject:</span> <span class="string">服务访问量提醒</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-sms-provider</span></span><br><span class="line"><span class="attr">          declaringClass:</span> <span class="string">"com.opay.trace.TraceIdFilter"</span></span><br><span class="line"><span class="attr">          methodName:</span> <span class="string">"invoke"</span></span><br><span class="line"><span class="attr">          relative:</span> <span class="number">7</span> <span class="comment">#与第N天数据比较</span></span><br><span class="line"><span class="attr">          level:</span> <span class="string">INFO</span></span><br><span class="line"><span class="attr">          limit:</span> <span class="number">100</span> <span class="comment">#浮动比例 100%</span></span><br></pre></td></tr></table></figure>

<h5 id="4、失败频次策略配置"><a href="#4、失败频次策略配置" class="headerlink" title="4、失败频次策略配置"></a>4、失败频次策略配置</h5><p>主要用于服务业务点功能频次分析，周期为1分/次，可设置日志level、频次阈值limit，可以通过配置declaringClass + methodName + successKeyword/failureKeyword组合方式实现项目的全局 / 细粒度报警，及时感知服务核心业务交易状况和压力值，快速提醒相关人员做出关键业务点承压防范。</p>
<p>业务功能范围：错误记录超量提醒、核心业务点超阈值报警、新上功能压力测算等。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    frequency:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0 0/1 * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="string">a483f4b1375a5a33b068c292413562c6aef6b32d7d1ae150c4d47d32f4af9322</span></span><br><span class="line"><span class="attr">          subject:</span> <span class="string">RECEIVEMONEY失败记录超量提醒</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-channel-provider</span></span><br><span class="line"><span class="attr">          declaringClass:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          methodName:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          successKeyword:</span> <span class="string">"ALERT-SUM-RECEIVEMONEY-SUCCESS"</span></span><br><span class="line"><span class="attr">          failureKeyword:</span> <span class="string">"ALERT-SUM-RECEIVEMONEY-FAIL"</span></span><br><span class="line"><span class="attr">          limit:</span> <span class="number">10</span> <span class="comment">#浮动比例 10%</span></span><br><span class="line"><span class="attr">          interval:</span> <span class="number">900</span> <span class="comment">#10分钟</span></span><br></pre></td></tr></table></figure>

<h5 id="5、黑名单信息策略配置"><a href="#5、黑名单信息策略配置" class="headerlink" title="5、黑名单信息策略配置"></a>5、黑名单信息策略配置</h5><p>主要用于服务业务关键性信息提醒（单次查询内第一条信息），周期为10秒/次，可结合各项指标的interval设定数据分析间隔时间，可设置日志level、频次阈值limit，可以通过配置declaringClass + methodName + keywords组合方式实现项目的全局 / 细粒度关键词报警，及时感知服务核心业务交易出现问题点，快速提醒相关人员做出关键业务修正。</p>
<p>业务功能范围：错误信息提醒，关键业务点状况提醒等。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    blackinfo:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0/10 * * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="string">a483f4b1375a5a33b068c292413562c6aef6b32d7d1ae150c4d47d32f4af9322</span></span><br><span class="line"><span class="attr">          subject:</span> <span class="string">TV充值退票</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-channel-callback</span></span><br><span class="line"><span class="attr">          declaringClass:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          methodName:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          interval:</span> <span class="number">10</span> <span class="comment">#10秒</span></span><br><span class="line"><span class="attr">          keywords:</span></span><br><span class="line"><span class="bullet">            -</span> <span class="string">CALLBACK-REQUEST</span></span><br></pre></td></tr></table></figure>

<h5 id="6、异常提醒策略配置"><a href="#6、异常提醒策略配置" class="headerlink" title="6、异常提醒策略配置"></a>6、异常提醒策略配置</h5><p>主要用于服务业务点throw异常分析，周期为1分/次，可结合各项指标的interval设定数据分析间隔时间，可以通过配置declaringClass + methodName + keywords 组合方式实现项目的全局 / 细粒度报警，及时感知服务核心关键业务异常状况，快速提醒相关人员做出关键业务点服务状况检查。</p>
<p>业务功能范围：服务调用异常提醒、核心业务异常报警等。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    exceptions:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0 * * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="number">2429618</span><span class="string">fec9ea28924cb4077d898e51c0053b7d693b7313daadecfb08057560a</span></span><br><span class="line"><span class="attr">          subject:</span> <span class="string">服务接口调用异常</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-graphql-web</span></span><br><span class="line"><span class="attr">          declaringClass:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          methodName:</span> <span class="string">"*"</span></span><br><span class="line"><span class="attr">          limit:</span> <span class="number">0</span> <span class="comment">#频次阈值</span></span><br><span class="line"><span class="attr">          interval:</span> <span class="number">300</span> <span class="comment">#5分钟</span></span><br><span class="line"><span class="attr">          keywords:</span></span><br><span class="line"><span class="bullet">            -</span> <span class="string">billCenterFacade.lookupBillCenterTransactions</span></span><br></pre></td></tr></table></figure>

<h5 id="7、节点策略配置"><a href="#7、节点策略配置" class="headerlink" title="7、节点策略配置"></a>7、节点策略配置</h5><p>主要用于实时监测服务在活状态，周期为30秒/次，可以通过配置节点IP+端口，保障各类服务安全稳健运行。</p>
<p>业务功能范围：HTTP服务在活监测、TCP服务在活监测、其他监控在活状态。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    nodes:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0/30 * * * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="number">7906</span><span class="string">fd7214b0935195862464fa14dc340e36ce4f2ba3bd1085b5ea935110dbda</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-sms-provider</span></span><br><span class="line"><span class="attr">          nodes:</span></span><br><span class="line"><span class="bullet">            -</span> <span class="number">10.112</span><span class="number">.21</span><span class="number">.120</span><span class="string">:11009</span></span><br></pre></td></tr></table></figure>

<h5 id="8、日报策略配置"><a href="#8、日报策略配置" class="headerlink" title="8、日报策略配置"></a>8、日报策略配置</h5><p>主要用于每天凌晨（北京8:00）推送项目运行报告，周期为1天/次，帮助您每天跟踪了解服务的访问量、日志量等。</p>
<p>业务功能范围：服务运行状况报告。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">elastic:</span></span><br><span class="line"><span class="attr">  monitor:</span></span><br><span class="line"><span class="attr">    diary:</span></span><br><span class="line"><span class="attr">      cron:</span> <span class="string">"0 0 8 * * ?"</span></span><br><span class="line"><span class="attr">      strategy:</span></span><br><span class="line"><span class="attr">        - alertBot:</span> <span class="string">a483f4b1375a5a33b068c292413562c6aef6b32d7d1ae150c4d47d32f4af9322</span></span><br><span class="line"><span class="attr">          serviceName:</span> <span class="string">payment-sms-provider</span></span><br></pre></td></tr></table></figure>

<h5 id="9、自检策略配置"><a href="#9、自检策略配置" class="headerlink" title="9、自检策略配置"></a>9、自检策略配置</h5><p>1) 监控服务自检提醒，周期为北京10,16,20点(可配）,管理人员每天感知监控服务在活状态；</p>
<p>2) 监控服务主从自检，周期为1分/次（固定），所有策略由主节点监测，防止重复检查和报警，主节点宕机3分钟后从节点升级为主节点，同时推送相关信息。</p>
<p>功能范围：服务在活状况检测、监控服务自检保障。</p>
<p>elastic:<br>  monitor:<br>    health:<br>      cron: “0 0 10,16,20 * * ?” #自检提醒周期<br>      strategy:<br>        alertBot: c678f3a0d6b8a19ab07c62a847994aaf3e684cfa7a41827dec7d91568b78ca1e</p>
<h4 id="关键配置项释义"><a href="#关键配置项释义" class="headerlink" title="关键配置项释义"></a>关键配置项释义</h4><table>
<thead>
<tr>
<th>配置项</th>
<th>说明</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td>alertBot</td>
<td>报警机器人Key</td>
<td>群机器人ID，需设置关键词“服务”</td>
</tr>
<tr>
<td>cron</td>
<td>cron定时周期</td>
<td>各策略循环周期</td>
</tr>
<tr>
<td>declaringClass</td>
<td>调用类</td>
<td>对应ELK字段，全部设置为“*”</td>
</tr>
<tr>
<td>keywords</td>
<td>关键词列表</td>
<td>message消息体内包含的关键词</td>
</tr>
<tr>
<td>level</td>
<td>消息等级</td>
<td>对应ELK字段，全部设置为“ALL”</td>
</tr>
<tr>
<td>limit</td>
<td>频次阈值/浮动比例</td>
<td>频次阈值-固定值，浮动比例-10 -&gt; 10% （90%~110%）</td>
</tr>
<tr>
<td>methodName</td>
<td>调用方法</td>
<td>对应ELK字段，全部设置为“*”</td>
</tr>
<tr>
<td>nodes</td>
<td>服务节点</td>
<td>IP+端口，TCP配置为“tcp://ip:port”（tcp://10.112.22.14:2181）</td>
</tr>
<tr>
<td>relative</td>
<td>环比天数</td>
<td>与前N天对比，单位：天</td>
</tr>
<tr>
<td>serviceName</td>
<td>项目服务名称</td>
<td>ELK日志服务名称 projectName</td>
</tr>
<tr>
<td>interval</td>
<td>间隔时间</td>
<td>监控调用间隔时间</td>
</tr>
<tr>
<td>subject</td>
<td>消息主题</td>
<td>报警项消息主题说明，在消息头显示</td>
</tr>
</tbody></table>
<p><strong>* 每个业务指标需确保1分钟内消息不超过20条 - alertBot钉钉机器人限制 *</strong></p>

        </div>

        <blockquote class="post-copyright">
    <!-- 
	
	-->
    <footer>
        <a href="https://github.com/weiecho">
            <img src="/img/avatar.jpg" alt="Wei Echo">
            Wei Echo
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/java/" rel="tag">java</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%BE%AE%E6%9C%8D%E5%8A%A1/" rel="tag">微服务</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E7%9B%91%E6%8E%A7%E6%8A%A5%E8%AD%A6/" rel="tag">监控报警</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://github.com/weiecho/2020/09/12/doc_1128/&title=《Elastic-Monitor 服务监控报警》 — Wei Echo&pic=https://github.com/weiecho/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://github.com/weiecho/2020/09/12/doc_1128/&title=《Elastic-Monitor 服务监控报警》 — Wei Echo&source=致力于中小型技术团队高效稳定的开发框架，全力打造简洁易用、灵活扩展的技术团队解决方案" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://github.com/weiecho/2020/09/12/doc_1128/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《Elastic-Monitor 服务监控报警》 — Wei Echo&url=https://github.com/weiecho/2020/09/12/doc_1128/&via=https://github.com/weiecho" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://github.com/weiecho/2020/09/12/doc_1128/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between flex-row-reverse">
  

  
    <div class="waves-block waves-effect next">
      <a href="/2020/09/10/exp_1118/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">xxl-job分布式定时任务策略验证说明</h4>
      </a>
    </div>
  
</nav>



    




















</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        谢谢您的支持~
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/img/wechat.png" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/img/wechat.png" data-alipay="/img/alipay.png">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <!-- <div class="top">
        

        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div> -->
    <div class="bottom">
        <p><span>Copyright &copy; 2017 - 2020</span>
            <span>
                
                Wei Echo All Rights Reserved
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://github.com/weiecho/2020/09/12/doc_1128/&title=《Elastic-Monitor 服务监控报警》 — Wei Echo&pic=https://github.com/weiecho/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://github.com/weiecho/2020/09/12/doc_1128/&title=《Elastic-Monitor 服务监控报警》 — Wei Echo&source=致力于中小型技术团队高效稳定的开发框架，全力打造简洁易用、灵活扩展的技术团队解决方案" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://github.com/weiecho/2020/09/12/doc_1128/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《Elastic-Monitor 服务监控报警》 — Wei Echo&url=https://github.com/weiecho/2020/09/12/doc_1128/&via=https://github.com/weiecho" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://github.com/weiecho/2020/09/12/doc_1128/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="/js/main.min.js?v=1.7.2"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="/js/search.min.js?v=1.7.2" async></script>










</body>
</html>
